'use strict';


module.exports = app => {
  const { STRING, CHAR,INTEGER } = app.Sequelize; // 获取数据类型
  const Menu = app.modelmysql.define('menu',
    {
        id: {
            type: CHAR(27),
            primaryKey: true
        },  
        name:{type:STRING},
        module_id: {
            type: CHAR(27),
            primaryKey: true
        },
        type: {
            type: INTEGER,
        },
        sort: {
            type: INTEGER,
        },
        url: {
            type: STRING,
        },
        description: {
            type: STRING,
        },
    },
  );
  Menu.associate = function() {
    app.modelmysql.Menu.hasMany(app.modelmysql.Menu, { foreignKey: 'id', sourceKey: 'module_id', through: null });
  };
  return Menu;
};
